<div class="corpus-header  clearfix">
  <ul class="nav navbar-nav nav-pills-bottomguide">
    <li <!--{if !$archive && !$delete && !$forceindex && !$modreason}-->class="active"<!--{/if}-->><a href="{DZZSCRIPT}?mod={MOD_NAME}&op=setting&do=manage">{lang normal}</a>
    </li>
    <li <!--{if $archive}-->class="active"<!--{/if}-->><a href="{DZZSCRIPT}?mod={MOD_NAME}&op=setting&do=manage&archive=1">{lang archived}</a>
    </li>
    <li <!--{if $delete}-->class="active"<!--{/if}-->><a href="{DZZSCRIPT}?mod={MOD_NAME}&op=setting&do=manage&delete=1">{lang deleted}</a>
    </li>
    
    <!--<button type="button" class="btn--> 
    <!--{if $modreason}--> 
    <!--btn-success--> 
    <!--{else}--> 
    <!--btn-default--> 
    <!--{/if}--> 
    <!--" onclick="location.href='{DZZSCRIPT}?mod={MOD_NAME}&op=setting&do=manage&modreason=1'">被封禁</button>--> 
    
    <li <!--{if $forceindex}-->class="active"<!--{/if}-->><a href="{DZZSCRIPT}?mod={MOD_NAME}&op=setting&do=manage&forceindex=1">{lang default_to_homepage}</a>
    </li>
    <li>
      <div class="dropdown pull-left ml10">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> 
        <!--{if $perm==-1}-->{lang perm}<!--{elseif $perm==0}--> {lang privately_owned}<!--{elseif $perm==1}--> {lang subframe}<!--{elseif $perm==2}--> {lang open}<!--{/if}--> 
        <span class="caret"></span> </button>
        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
          <li><a href="$theurl">{lang all}</a></li>
          <li><a href="$theurl&perm=0">{lang privately_owned}</a></li>
          <li><a href="$theurl&perm=1">{lang subframe}</a></li>
          <li><a href="$theurl&perm=2">{lang open}</a></li>
        </ul>
      </div>
    </li>
  </ul>
</div>
<form id="manageform" name="manageform" class="form-horizontal" action="{BASESCRIPT}?mod={MOD_NAME}&op=setting&do=manage" method="post" onsubmit="return validate(this);">
  <input type="hidden" name="settingsubmit" value="true" />
  <input type="hidden" name="refer" value="{eval echo urldecode($refer);}" />
  <input type="hidden" name="formhash" value="{FORMHASH}" />
  <table class="table table-hover">
    <tr style="background:#fff!important">
      <th> <div class="checkbox-custom checkbox-primary">
          <input type="checkbox" name="chkall" id="chkall" title="{lang check_all}" onclick="checkAll('prefix', this.form, 'del')"/>
          <label for="chkall"></label>
        </div>
      </th>
      <th>{lang menu_filemanagedisp_0}</th>
      <th><!--{if $order=='orgid'}--><span class="text-danger" title=""><i class="fa fa-group"></i>{lang group}</span><!--{else}--><a href="$theurl&order=orgid" title="{lang sort_by_group}"><i class="fa fa-group"></i>{lang group}</a><!--{/if}--></th>
      <th>{lang jurisdiction}</th>
      <th><!--{if $order=='documents'}--><span class="text-danger" title="{lang document_number}"><i class="fa fa-file"></i>{lang document_number}</span><!--{else}--><a href="$theurl&order=documents" title="{lang document_number}"><i class="fa fa-file"></i>{lang document_number}</a><!--{/if}--> 
        <br/>
        
        <!--{if $order=='members'}--><span class="text-danger" title="{lang number_of_member}"><i class="fa fa-user"></i>{lang number_of_member}</span><!--{else}--><a href="$theurl&order=members" title="{lang number_of_member}"><i class="fa fa-user"></i>{lang number_of_member}</a><!--{/if}--></th>
      <th><!--{if $order=='viewnum'}--><span class="text-danger" title="{lang viewcount}"><i class="fa fa-eye"></i>{lang viewcount}</span><!--{else}--><a href="$theurl&order=viewnum" title="{lang viewcount}"><i class="fa fa-eye"></i>{lang viewcount}</a><!--{/if}--> 
        <br/>
        
        <!--{if $order=='downloads'}--><span class="text-danger" title="{lang download_times}"><i class="fa fa-download"></i>{lang download_times}</span><!--{else}--><a href="$theurl&order=downloads" title="{lang download_times}"><i class="fa fa-download"></i>{lang download_times}</a><!--{/if}--></th>
      <th>{lang state}</th>
      <th> <!--{if $order=='dateline'}--><span>{lang property_filedate}</span><!--{else}--><a href="$theurl&order=dateline" title="{lang according_to_this_order}">{lang property_filedate}</a><!--{/if}--><br/>
        
        <!--{if $order=='updatetime'}--><span class="text-danger">{lang turnover_time}</span><!--{else}--><a href="$theurl&order=updatetime" title="{lang according_to_this_order}">{lang turnover_time}</a><!--{/if}--> </th>
      <th>{lang operation}</th>
    </tr>
    <!--{loop $list $value}-->
    <tr>
      <td>
         <div class="checkbox-custom checkbox-primary"> <input type="checkbox" name="del[]" value="$value[cid]" <!--{if $value[system]}-->disabled<!--{/if}--> class="input_check"/>
          <label></label>
        </div></td>
      <td >
         <div style="max-width:300px;" id="corpus_{$value['cid']}"> <a href="{DZZSCRIPT}?mod={MOD_NAME}&op=list&cid=$value[cid]" target="_blank"> 
          <!--{if $value['aid']}--> 
          <img src="{DZZSCRIPT}?mod=io&op=thumbnail&path={eval echo dzzencode('attach::'.$value[aid]);}" height="50" />&nbsp; 
          <!--{/if}--> 
          $value[name] </a> &nbsp;<small  style="color:#999">$value['username']</small> </div></td>
      <td><a href="{DZZSCRIPT}?mod={MOD_NAME}&op=org&orgid=$value[orgid]" target="_blank">$value[orgname]</a></td>
      <td><!--{if $value[perm]==2}-->{lang open} 
        <!--{elseif $value['perm']==1 && $value[org]}-->{lang subframe} 
        <!--{else}-->{lang privately_owned}<!--{/if}--></td>
      <td> {$value['documents']} <br/>
        {$value['members']} </td>
      <td> {$value['viewnum']} <br/>
        {$value['downloads']} </td>
      <td><!--{if $value[deletetime]>0}--> 
        <a href="user.php?uid=$value[deleteuid]" target="_blank">$value['deleteusername']</a>&nbsp;{eval echo dgmdate($value[deletetime],'u');}&nbsp;{lang delete} 
        <!--{elseif $value[archivetime]>0}--> 
        <a href="user.php?uid=$value[archiveuid]" target="_blank">$value['archiveusername']</a>&nbsp;{eval echo dgmdate($value[archivetime],'u');}&nbsp;{lang archive} 
        <!--{else}--> 
        {lang normal} 
        <!--{/if}--></td>
      <td><p>{eval echo dgmdate($value[dateline],'u');}</p>
        
        <!--{if $value[updatetime]}-->
        <p style="margin-bottom:0">{eval echo dgmdate($value[updatetime],'u');}</p>
        <!--{/if}--></td>
      <td><!--{if $value['archivetime']<1 && $value['deletetime']<1}--> <a class="btn btn-link" href="{BASESCRIPT}?mod={MOD_NAME}&op=setting&do=manage&operation=archive&cid=$value[cid]&refer=$refer" title="{lang archive}" onclick="if(confirm('{lang sure_you_want_to_archive_this_corpus}')){return true}else{return false}">{lang archive}</a><!--{/if}--> 
        <!--{if $value['archivetime']>0 || $value['deletetime']>0}--> <a class="btn btn-link" href="{BASESCRIPT}?mod={MOD_NAME}&op=setting&do=manage&operation=restore&cid=$value[cid]&refer=$refer" title="{lang recover}" onclick="if(confirm('{lang sure_you_want_to_restore_this_corpus}')){return true}else{return false}" title="{lang recover}" >{lang recover}</a><!--{/if}--> 
        <!--{if ($value['archivetime']<1 && $value['deletetime']<1 && $value['perm']>1) || $forceindex}-->
        <button class="btn btn-link" data-loading-title="{lang Setting}" title="{lang default_to_homepage}" onclick="setForceIndex(this,'$value[cid]');return false;"> 
        <!--{if $value['forceindex']<1}--> 
        {lang default_to_homepage} 
        <!--{else}--> 
        {lang cancel_the_default} 
        <!--{/if}--> 
        </button>
        
        <!--{/if}--> 
        <!--<a class="btn btn-link js-popbox" data-href="{DZZSCRIPT}?mod={MOD_NAME}&op=menu&do=topic&operation=ban&cid=$value[cid]" title="封禁/取消" data-placement="bottom" data-auto-adapt="true"  href="javascript:;">--> 
        <!--{if $value['modreasons']}--> 
        <!--取消封禁--> 
        <!--{else}--> 
        <!--封禁--> 
        <!--{/if}--> 
        <!--</a>--></td>
    </tr>
    <!--{/loop}-->
    <tfoot>
      <tr>
        <td colspan="20"><button type="submit" class="btn btn-primary submit-delete" disabled >{lang delete_completely}</button>
          <span class="text-danger text-center" style="padding:6px 10px"><b><i class="glyphicon glyphicon-exclamation-sign"></i>&nbsp;{lang the_delete_operation_here_will_not_recover}</b></span> $multi
		  </td>
	</tr>
    </tfoot>
  </table>
</form>
<div class="alert alert-warning" style="margin:0 15px;margin-bottom:25px;">
  <button type="button" class="close" data-dismiss="alert">&times;</button>
  <h5><b>{lang hint}</b></h5>
  <ul >
    <li>{lang archived_corpus_and_deleted_files_are_not_displayed_on_the_user_interface}</li>
    <li>{lang users_cannot_cancel_but_can_sort}</li>
    <li>{lang default_to_homepage_in_vain}</li>
  </ul>
</div>
<script type="text/javascript" src="admin/scripts/admin.js"></script> 
<script type="text/javascript">
jQuery('.a_click').addClass('a_click2');



function setForceIndex(obj,cid){
	var el=jQuery(obj);
	 el.button('loading');
	 var url=DZZSCRIPT+'?mod={MOD_NAME}&op=setting&do=manage&operation=forceindex&cid='+cid;
	 jQuery.getJSON(url,function(json){
		 if(json && json.cid>0){
			 el.html(__lang.successfully_set); 
			 window.setTimeout(function(){
				 //el.button('reset');
				 if(json.forceindex>0){
					el.html(__lang.cancel_the_default);
				 }else{
					el.html(__lang.default_to_homepage);
				 } 
			},1000);
		 }else if(json.error){
			 el.button(json.error);
			 window.setTimeout(function(){el.button('reset')},1000); 
		 }
		
	 });
}
function validate(form){
	
	if(confirm(__lang.sure_you_want_to_delete_the_selected_corpus)){
		return true;
	}else{
		return false;
	}
}
	function hasChecked(){
		if(jQuery('tr.tr_checked').length){
			console.log('dddd');
			jQuery('button.submit-delete').prop('disabled',false);
		}else{
			jQuery('button.submit-delete').prop('disabled',true);
		}
	}

// 选中
jQuery('input[class=input_check]').click(function(){

    if(jQuery(this).prop('checked')){
        jQuery(this).closest('tr').addClass('tr_checked');
    }else{
        jQuery(this).closest('tr').removeClass('tr_checked');
    }
	hasChecked()
});

jQuery('input[name=chkall]').click(function(){

    jQuery('input[class=input_check]').each(function(){
        if(jQuery(this).prop('checked')){
            jQuery(this).closest('tr').addClass('tr_checked');
        }else{
            jQuery(this).closest('tr').removeClass('tr_checked');
        }
    });
	hasChecked();
});
// 结束
</script> 
